package cn.edu.jxyy.mybatistest.test;


import cn.edu.jxyy.mybatistest.Utils.MyBatisUtils;

import cn.edu.jxyy.mybatistest.mapper.StudentMapper;
import cn.edu.jxyy.mybatistest.pojo.Student;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class part14_2 {
    public static void main(String[] args){
        SqlSession sqlSession = MyBatisUtils.getSession();
        // 创建Customer对象，封装需要组合查询的条件++
        Student student = new Student();
        student.setName("Jim");
        student.setAge(20);


        // 执行SqlSession的查询方法，返回结果集
        StudentMapper studentMapper =
                sqlSession.getMapper(StudentMapper.class);
        List<Student> students = studentMapper.findStudent(student);

        // 输出查询结果信息
        for (Student student1 : students) {
            // 打印输出结果
            System.out.println(student1);
        }
        // 关闭SqlSession
        sqlSession.close();


    }
}
